import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { IsNotEmpty } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
@Entity()
export class TongBuPosition {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '用户id' })
  @ApiProperty({ description: '用户名', example: 'admin' })
  @IsNotEmpty({ message: '用户名不能为空' })
  userId: string;

  @Column({ comment: '用户名' })
  @ApiProperty({ description: '用户名', example: 'admin' })
  @IsNotEmpty({ message: '用户名不能为空' })
  userName: string;

  @Column({ comment: '方向', default: 1 })
  @ApiProperty({ description: '方向', example: 1 })
  direction: number;

  @Column({ comment: 'key', default: 1 })
  key: string;

  @Column({ comment: '同步时间', default: '0' })
  tongBuTime: string;

  @Column({ comment: '开始时间', default: '0' })
  startTime: string;

  @Column({ comment: '结束时间', default: '0' })
  endTime: string;

  @Column({ comment: '平仓数量', default: '0' })
  pingCangNum: string;

  @Column({ comment: '芝麻盈亏-之前', default: '0' })
  yingKuiZhiQian: string;

  @Column({ comment: '芝麻盈亏-本次', default: '0' })
  yingKuiBenCi: string;

  @Column({ comment: '芝麻盈亏-总', default: '0' })
  yingKuiAll: string;

  @Column({ comment: '用户总资产', default: '0' })
  @ApiProperty({ description: '用户总资产', example: '1' })
  allMoney: string;

  // 历史委托同步信息
  @Column({ comment: '历史委托数量', default: '0' })
  @ApiProperty({ description: '历史委托数量', example: '0' })
  weiTuoNum: number;

  @CreateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'create_time',
    comment: '创建时间',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp',
    nullable: false,
    name: 'update_time',
    comment: '更新时间',
  })
  update_time: string;
}
